#include "brick.h"

void Brick::move()
{
	/* Move towards mark */

	//Mark is above (behind) brick
	if (mark < loc.z)
		//Distance is smaller than speed - go to mark
		if (loc.z -mark < speed)
			loc.z = mark;
		//Distance is bigger than speed - go towards mark
		else loc.z -= speed;
	//Mark is below (in front of) brick
	else
		//Distance is smaller than speed - go to mark
		if (mark -loc.z < speed)
			loc.z = mark;
		//Distance is bigger than speed - go towards mark
		else loc.z += speed;
}

